<extend name="Public:common"/>
<block name="main">
    <style type="text/css">
        .am-selected {
            width: 100%;
        }
        .am-selected-status {
            text-align: left;
            width: 100%;
            display: block;
            word-wrap: normal;
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
        }
        .am-dropdown-toggle {
            border-color: #ccc;
            line-height: inherit;
        }

    </style>
    <div data-am-widget="tabs" class="am-tabs am-tabs-secondary" id="doc-form-tabs" >
        <ul class="am-tabs-nav am-cf">
            <li class=""><a href="__APP__/Home/Add/index/type/2">支出</a></li>
            <li class=""><a href="__APP__/Home/Add/index/type/1">收入</a></li>
            <li class="am-active"><a href="__APP__/Home/Add/transfer">转账</a></li>
        </ul>
        <div class="am-tabs-bd">
            <div data-tab-panel-1 class="am-tab-panel">
                <include file="Public:loading"/>
            </div>
            <div data-tab-panel-2 class="am-tab-panel">
                <include file="Public:loading"/>
            </div>
            <div data-tab-panel-3 class="am-tab-panel am-active">
                <form class="am-form am-form-horizontal" enctype="multipart/form-data" method="post" data-am-validator="H5validation:false" id="transfer-form">
                    <legend>账户转账</legend>
                    <div class="am-input-group">
                        <span class="am-input-group-label"><b>转账金额</b></span>
                        <input type="number" class="am-form-field" id="text-money" name="transfer_money" step=0.01 placeholder="输入转账金额" required>
                        <p></p>
                    </div>
                    <div><p></p></div>
                    <div class="am-input-group">
                        <span class="am-input-group-label"><b>转出账户</b></span>
                        <select id="select-funds-source" class="am-form-field" name="transfer_funds_source" placeholder="选择转出账户" required>
                            <option value="">选择转出账户</option>
                            <foreach name="FundsData" item="data">
                                <if condition="$data.id gt 0">
                                    <option value="{$data.id}">{$data.name}</option>
                                </if>
                            </foreach>
                        </select>
                        <span class="am-form-caret"></span>
                    </div>
                    <div><p></p></div>
                    <div class="am-input-group">
                        <span class="am-input-group-label"><b>转入账户</b></span>
                        <select id="select-funds-target" class="am-form-field" name="transfer_funds_target" placeholder="选择转入账户" required>
                            <option value="">选择转入账户</option>
                            <foreach name="FundsData" item="data">
                                <if condition="$data.id gt 0">
                                    <option value="{$data.id}">{$data.name}</option>
                                </if>
                            </foreach>
                        </select>
                        <span class="am-form-caret"></span>
                    </div>
                    <div><p></p></div>
                    <div class="am-input-group">
                        <span class="am-input-group-label"><b>转账备注</b></span>
                        <input type="text" class="am-form-field" id="text-mark" name="transfer_mark" placeholder="输入支出信息">
                    </div>
                    <div><p></p></div>
                    <div class="am-input-group">
                        <span class="am-input-group-label"><b>转账时间</b></span>
                        <input type="date" class="am-form-field" id="text-time" name="transfer_time" value="<php>echo date('Y-m-d',time());</php>" />
                    </div>

                    <p><hr data-am-widget="divider" style="" class="am-divider am-divider-dashed" /></p>
                    
                    <p><button type="submit" name="submit" class="am-btn am-btn-secondary am-btn-block">转账</button></p>
                    <p><a href="{$refURL}" class="am-btn am-btn-block am-btn-default">返回</a></p>
                </form>
            </div>
        </div>
    </div>
    <include file="Public:list_transfer"/>
</block>

<block name="javascript">
    <script>
      $(function() {
        $('#doc-form-tabs').find('a').on('opened.tabs.amui', function(e) {
          if ($(this).text() != '转账') {
            window.location.href = $(this).context.href;
          }
        });
      });
    </script>
</block>